#include "typedefs.h"
#define ETH_FRAME_LEN 1514
#define MAX_LINE 25

#define LANCE_LOG_RX_BUFFERS	2		/* Use 2^2=4 Rx buffers */
#define LANCE_LOG_TX_BUFFERS	1		/* Use 2^1=2 Tx buffers */

#define RX_RING_SIZE		(1 << (LANCE_LOG_RX_BUFFERS))
#define RX_RING_MOD_MASK	(RX_RING_SIZE - 1)
#define RX_RING_LEN_BITS	((LANCE_LOG_RX_BUFFERS) << 29)
#define TX_RING_LEN_BITS	((LANCE_LOG_TX_BUFFERS) << 29)

#define ETH_ALEN 6
#define ETH_HLEN 14

/* Offsets from base I/O address. */
#define PCNET32_ETH_ADDR        (unsigned long) 0x0
#define PCNET32_WIO_RDP		0x10
#define PCNET32_WIO_RAP		0x12
#define PCNET32_WIO_RESET	0x14
#define PCNET32_WIO_BDP		0x16

#define PCNET32_DWIO_RDP	0x10
#define PCNET32_DWIO_RAP	0x14
#define PCNET32_DWIO_RESET	0x18
#define PCNET32_DWIO_BDP	0x1C


struct tx_head
{
	union {
		unsigned long base;
		unsigned char addr[4];
	} u;
        signed short buf_length;
        signed short misc;
};

struct init_block
{
        unsigned short mode;
        unsigned char phy_addr[6];
        unsigned int filter[2];
        unsigned int rx_ring;
        unsigned int tx_ring;
};

struct rx_head
{
	union {
		unsigned long base;
		unsigned char addr[4];
	} u;
        signed short buf_length;
        signed short msg_length;
};

typedef struct pcnet_priv
{
	struct init_block init_block;
	struct rx_head rx_ring[4];
	struct tx_head tx_ring[2];
	unsigned char		rbuf[4][ETH_FRAME_LEN+4];
	unsigned char		tbuf[ETH_FRAME_LEN];
	/*
	 * Do not alter the order of the struct members above;
	 * the hardware depends on the correct alignment.
	 */
	int			rx_idx;
	int options;
	unsigned char node_addr[6];
}pcnet32_private_t;

pcnet32_private_t pcnet32_private;

extern unsigned char * hwaddress;

extern dword pcnet_base;
extern unsigned long pcnet_dev, pcnet_bus;
unsigned int pcnet_chip_version;
extern unsigned long pcnet_entry_point;
int pcnet32_probe1(unsigned long);
void pcnet32_transmit(const char *, unsigned int , unsigned , unsigned char *);
void pcnet32_reset(unsigned long);
